/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.apt.matrimony.utils;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import org.apt.matrimony.methods.selects;
//import org.apt.matrimony.methods.;
/**
 *
 * @author yoko
 */
public class Tools {
/* public static Boolean checkDate(String username){
     try {
         Calendar calendar = Calendar.getInstance();
         Calendar currentDate = Calendar.getInstance();
         int accountId=sel.getAccountIdByAccountName(username);
         DateFormat formatter=new SimpleDateFormat("dd-MM-yyyy");
         String dateString=sel.getDateFromAccount(accountId);
         Date date=formatter.parse(dateString);
        //String dateNow=formatter.format(currentDate.getTime());
         //if(dateNow.equalsIgnoreCase(dateString)){
         if(dateString.equalsIgnoreCase("2013-12-24 00:00:00.0")){
             return true;
         }
     } catch (Exception e) {
     }
   return false;
 }
 public static String check(){
      String d="";
     try {
          String dateString=sel.getDateFromAccount(2);
          d=dateString;
     } catch (Exception e) {
     }
     return d;
 }*/
     public static Boolean checkDate(String username){
     try {
         Calendar calendar = Calendar.getInstance();
         Calendar currentDate = Calendar.getInstance();
         int accountId=selects.getAccountIdByAccountName(username);
         DateFormat formatter=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String dateString=selects.getDateFromAccount(accountId);
         Date date=formatter.parse(dateString);
        String dateNow=formatter.format(currentDate.getTime());
         if(dateNow.equalsIgnoreCase(dateString)){
                   return true;
         }
     } catch (Exception e) {
     }
   return false;
 }
     public static String convertTime2String(Date time){
         String sTime="";
         try {
          DateFormat df=new SimpleDateFormat("dd-MM-yyyy");
          sTime=df.format(time);
         } catch (Exception e) {
         }
         return sTime;
     }

     public static void main(String[] args){
     System.out.print("");
 }
}
